<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <link rel="icon" href="../../images/hospital-icon.png" type="image/x-icon">  <!--在网页标题左侧显示图标-->
    <!--    <link rel="shortcut icon" href="./images/hospital-icon.png" type="image/x-svg">-->
    <link rel="shortcut icon" href="../../images/hospital-icon.png" type="image/x-icon"><!--在收藏夹显示图标-->

    <title>入院登记管理-门诊管理系统</title>

    <!--时间风格及输入框风格-->
    <!--pickers css-->
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-datepicker/css/datepicker-custom.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-timepicker/css/timepicker.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-colorpicker/css/colorpicker.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-datetimepicker/css/datetimepicker-custom.css" />

    <link href="../../css/style.css" rel="stylesheet">
    <link href="../../css/style-responsive.css" rel="stylesheet">
    <!--时间风格及输入框风格-->

    <!--data table-->
    <link rel="stylesheet" href="../../js/data-tables/DT_bootstrap.css" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="../../js/html5shiv.js"></script>
    <script src="../../js/respond.min.js"></script>
    <![endif]-->
    <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

</head>

<body class="sticky-header">

<section>
    <!-- left side start-->
    <!--左侧开始-->
    <div class="left-side sticky-left-side">

        <!--logo and iconic logo start-->
        <!--侧边栏顶部图标+文字-->
        <div class="logo">
            <a href="index_nurse.html">
                <img src="../../images/hospital-icon.png" alt="" style="width: 40px;height: 40px">
                <p style="display: inline-block;font-size: 24px;">门诊管理系统</p>
            </a>
        </div>

        <!--收起状态的侧边栏顶部图标-->
        <div class="logo-icon text-center">
            <a href="index_nurse.html"><img src="../../images/hospital-icon.png" alt="" style="width: 40px;height: 40px"></a>
        </div>
        <!--logo and iconic logo end-->

        <div class="left-side-inner">

            <!--sidebar nav start-->
            <!--侧边栏-->
            <ul class="nav nav-pills nav-stacked custom-nav">


                <li class="menu-list nav-active">
                    <a href="">
                        <i class="fa fa-book"></i>
                        <span>患者管理</span>
                    </a>
                    <ul class="sub-menu-list">
                        <li class="active"><a href="admissionList.html"> 入院登记管理</a></li>
                        <li><a href="appointmentList.html">预约挂号管理</a></li>
                        <li><a href="patientInfoList.html"> 患者信息管理</a></li>
                    </ul>
                </li>

                <li class="logout">
                    <a href="#">
                        <i class="fa fa-sign-in"></i>
                        <span>退出登录</span>
                    </a>
                </li>

            </ul>
            <!--sidebar nav end-->
            <!--侧边栏导航结束-->

        </div>
    </div>
    <!-- left side end-->
    <!-- 左侧 部分 结束 -->

    <!-- main content start-->
    <div class="main-content" >

        <!-- header section start-->
        <!--顶部菜单部分开始-->
        <div class="header-section">

            <!--toggle button start-->
            <!--拨动按钮-收起侧边栏-->
            <a class="toggle-btn"><i class="fa fa-bars"></i></a>
            <!--toggle button end-->

            <!--notification menu start -->
            <!--通知菜单开始-->
            <div class="menu-right" id="headerApp">
                <ul class="notification-menu">

                    <li>
                        <a href="#" class="btn btn-default dropdown-toggle info-number logout" data-toggle="dropdown">
                            退出登录
                            <i class="fa fa-sign-out"></i>
                        </a>
                    </li>


                </ul>
            </div>
            <!--notification menu end -->
            <!--通知菜单结束-->
        </div>
        <!-- header section end-->
        <!--顶部菜单部分结束-->

        <!--body wrapper start-->
        <div class="wrapper">
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel" id="admissionApp">
                        <header class="panel-heading">
                            入院登记管理
                            <span class="tools pull-right"></span>
                        </header>
                        <div class="panel-body">
                            <div class="adv-table editable-table ">

                                <div class="clearfix"  style="margin-bottom: 20px">
                                    <form class="form-inline" role="form">

                                        <a href="#newAdmission" class="btn btn-info details" data-toggle="modal">
                                            新增
                                            <i class="fa fa-plus"></i>
                                        </a>

                                        <!-- Modal -->
                                        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="newAdmission" class="modal fade">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header" style="width: auto;height: auto">
                                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                        <h4 class="modal-title">新增入院登记</h4>
                                                    </div>
                                                    <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">选择预约:</label>
                                                            <div class="col-sm-8">
                                                                <input v-model="addAppointmentDetailInput" @change="addSelectAppointmentList()" data-toggle="dropdown" type="text" class="form-control dropdown-toggle" style="width: 300px" placeholder="根据患者姓名查询">
                                                                <ul role="menu" class="dropdown-menu" style="position: absolute;right: 15px">
                                                                    <li v-for="appointment in addAppointmentList">
                                                                        <a href="#" @click="checkThisAppointment(appointment.appointmentId,appointment.patientId,appointment.patientName,appointment.returnAppointmentStartTime)">
                                                                            <span v-text="appointment.patientId">1</span>
                                                                            <span v-text="appointment.patientName"> 曾晨</span>
                                                                            <span>预约号：</span>
                                                                            <span v-text="appointment.appointmentId"> 4</span>
                                                                            <span>号</span>
                                                                            <span>预约时间</span>
                                                                            <span v-text="appointment.returnAppointmentStartTime"></span>
                                                                        </a>
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">选择入院登记类型:</label>
                                                            <div class="col-sm-8">
                                                                <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                                    <span v-text="addAdmissionTypeName"> 入院登记类型 </span>
                                                                    <span class="caret"></span>
                                                                </button>
                                                                <ul role="menu" class="dropdown-menu">
                                                                    <li><a href="#" @click="addCheckAdmissionType(0,'门诊')">门诊</a></li>
                                                                    <li><a href="#" @click="addCheckAdmissionType(1,'住院')">住院</a></li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">选择科室:</label>
                                                            <div class="col-sm-8">
                                                                <input v-model="addDepartmentName" @change="addSelectDepartmentList()" data-toggle="dropdown" type="text" class="form-control dropdown-toggle" style="width: 300px" placeholder="根据科室名称查询">
                                                                <ul role="menu" class="dropdown-menu" style="position: absolute;right: 15px">
                                                                    <li v-for="department in addDepartmentList">
                                                                        <a href="#" @click="addCheckThisDepartment(department.id,department.specialtyName,department.departmentName,department.departmentAddress)">
                                                                            <span>专科：</span>
                                                                            <span v-text="department.specialtyName"> 曾晨</span>
                                                                            <span>科室：</span>
                                                                            <span v-text="department.departmentName"> 4</span>
                                                                            <span>位置：</span>
                                                                            <span v-text="department.departmentAddress"></span>
                                                                        </a>
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">选择医生:</label>
                                                            <div class="col-sm-8">
                                                                <input v-model="addDoctorName" @change="addSelectDoctorList()" data-toggle="dropdown" type="text" class="form-control dropdown-toggle" style="width: 300px" placeholder="根据医生姓名查询">
                                                                <ul role="menu" class="dropdown-menu" style="position: absolute;right: 15px">
                                                                    <li v-for="addStaff in addStaffList">
                                                                        <a href="#" @click="addCheckThisStaff(addStaff.staffId,addStaff.staffName,addStaff.jobTitleName,addStaff.departmentName)">
                                                                            <span v-text="addStaff.staffName">1</span>
                                                                            <span>-</span>
                                                                            <span v-text="addStaff.jobTitleName"> 曾晨</span>
                                                                            <span>-</span>
                                                                            <span v-text="addStaff.departmentName"> 4</span>
                                                                            <span>-</span>
                                                                            <span v-text="addStaff.jobTypeName"></span>
                                                                        </a>
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">症状简介:</label>
                                                            <div class="col-sm-8">
                                                                <input v-model="addAdmissionSymptoms"  class="col-sm-12" type="text" class="form-control" placeholder="请输入症状简介">
                                                            </div>
                                                        </div>
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">费用类型:</label>
                                                            <div class="col-sm-8">
                                                                <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                                    <span v-text="addFeeTypeName"> 费用类型 </span>
                                                                    <span class="caret"></span>
                                                                </button>
                                                                <ul role="menu" class="dropdown-menu">
                                                                    <li><a href="#" @click="addCheckFeeType(0,'自费')">自费</a></li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                        <button type="button" class="btn btn-default" data-dismiss="modal" @click="addAdmissionResetButton()">取消</button>
                                                        <button type="button" class="btn btn-success" @click="addAdmissionButton()">保存</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="btn-group">
                                            <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                <span v-text="selectPageSizeName">分页数</span>
                                                <span class="caret"></span>
                                            </button>
                                            <ul role="menu" class="dropdown-menu">
                                                <li><a href="#" @click="checkSelectPageNum(10)">10</a></li>
                                                <li><a href="#" @click="checkSelectPageNum(20)">20</a></li>
                                                <li><a href="#" @click="checkSelectPageNum(30)">30</a></li>
                                            </ul>
                                        </div>

                                        <div class="form-group" >
                                            <div class="flat-blue single-row">
                                                <div class="radio ">
                                                    <label>选择时间： </label>
                                                    <input id="selectAdmissionTime" class="form-control form-control-inline input-medium default-date-picker" placeholder="选择时间" size="16" type="text" value="" />
                                                </div>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <input v-model="selectPatientName" type="text" class="form-control" style="width: 300px" placeholder="根据患者姓名模糊查询">
                                        </div>

                                        <button type="button" class="btn btn-info" @click="selectAdmissionButton()">
                                            查询
                                            <i class="fa fa-search"></i>
                                        </button>
                                        <button type="button" class="btn btn-default" @click="resetSelect()">
                                            重置
                                            <i class="fa fa-undo"></i>
                                        </button>

                                    </form>
                                </div>


                                <table class="table table-striped table-hover table-bordered" id="editable-sample">
                                    <thead>
                                    <tr>
                                        <th>入院号</th>
                                        <th>预约ID</th>
                                        <th>患者ID</th>
                                        <th>患者姓名</th>
                                        <th>科室名称</th>
                                        <th>医生名称</th>
                                        <th>登记类型</th>
                                        <th>登记症状</th>
                                        <th>费用类型</th>
                                        <th>创建时间</th>
                                        <th>修改</th>
                                        <th>删除</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr class="" v-for="admission in admissionList">
                                        <td v-text="admission.admissionId">1</td>
                                        <td v-text="admission.appointmentId">1</td>
                                        <td v-text="admission.patientId">1</td>
                                        <td v-text="admission.patientName">曾晨</td>
                                        <td v-text="admission.departmentName">骨科一科</td>
                                        <td v-text="admission.staffName">曾晨-主任</td>
                                        <td class="center">
                                            <span class="label label-info" v-if="admission.appointmentType==0" v-text="admission.appointmentTypeName">门诊</span>
                                            <span class="label label-info" v-if="admission.appointmentType==1" v-text="admission.appointmentTypeName">住院</span>
                                        </td>
                                        <td v-text="admission.admissionSymptoms">骨折</td>
                                        <td class="center">
                                            <span class="label label-info" v-text="admission.feeTypeName">自费</span>
                                        </td>
                                        <td class="center" v-text="admission.returnCreateTime">2022-04-28</td>

                                        <td>
                                            <a href="#modifyAdmission" class="details" style="color: #46b8da;" data-toggle="modal" @click="modifyAdmissionButton(admission.admissionId)">修改</a>

                                        </td>

                                        <td>
                                            <a :href="'#deleteyMyAppointment' + admission.admissionId" class="details" style="color: #46b8da;" data-toggle="modal">删除</a>
                                            <!-- Modal -->
                                            <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" :id="'deleteyMyAppointment'+admission.admissionId" class="modal fade">
                                                <div class="modal-dialog">
                                                    <div class="modal-content">
                                                        <div class="modal-header" style="width: auto;height: auto">
                                                            <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                            <h4 class="modal-title">删除预约</h4>
                                                        </div>
                                                        <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                            <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                                <label class="col-sm-4 control-label">是否确认删除预约</label>
                                                            </div>
                                                        </div>
                                                        <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                                            <button type="button" class="btn btn-success" @click="deleteAdmission(admission.admissionId)">保存</button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>

                                <!--修改组件-->
                                <!-- Modal -->
                                <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="modifyAdmission" class="modal fade">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header" style="width: auto;height: auto">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">修改入院登记</h4>
                                            </div>
                                            <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">入院号:</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyAdmissionDetail.admissionId" type="text" class="form-control" style="width: 300px" placeholder="根据患者姓名查询" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">预约ID:</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyAdmissionDetail.appointmentId" type="text" class="form-control" style="width: 300px" placeholder="根据患者姓名查询" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">选择入院登记类型:</label>
                                                    <div class="col-sm-8">
                                                        <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                            <span v-text="modifyAdmissionDetail.appointmentTypeName"> 入院登记类型 </span>
                                                            <span class="caret"></span>
                                                        </button>
                                                        <ul role="menu" class="dropdown-menu">
                                                            <li><a href="#" @click="modifyCheckAdmissionType(0,'门诊')">门诊</a></li>
                                                            <li><a href="#" @click="modifyCheckAdmissionType(1,'住院')">住院</a></li>
                                                        </ul>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">选择科室:</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyAdmissionDetail.departmentName" @change="admissionModifySelectDepartmentList()" data-toggle="dropdown" type="text" class="form-control dropdown-toggle" style="width: 300px" placeholder="根据科室名称查询">
                                                        <ul role="menu" class="dropdown-menu" style="position: absolute;right: 15px">
                                                            <li v-for="department in modifyDepartmentList">
                                                                <a href="#" @click="admissionModifyCheckThisDepartment(department.id,department.specialtyName,department.departmentName,department.departmentAddress)">
                                                                    <span>专科：</span>
                                                                    <span v-text="department.specialtyName"> 曾晨</span>
                                                                    <span>科室：</span>
                                                                    <span v-text="department.departmentName"> 4</span>
                                                                    <span>位置：</span>
                                                                    <span v-text="department.departmentAddress"></span>
                                                                </a>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">选择医生:</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyAdmissionDetail.staffName" @change="admissionModifySelectDoctorList()" data-toggle="dropdown" type="text" class="form-control dropdown-toggle" style="width: 300px" placeholder="根据医生姓名查询">
                                                        <ul role="menu" class="dropdown-menu" style="position: absolute;right: 15px">
                                                            <li v-for="addStaff in modifyStaffList">
                                                                <a href="#" @click="modifyCheckThisStaff(addStaff.staffId,addStaff.staffName,addStaff.jobTitleName,addStaff.departmentName)">
                                                                    <span v-text="addStaff.staffName">1</span>
                                                                    <span>-</span>
                                                                    <span v-text="addStaff.jobTitleName"> 曾晨</span>
                                                                    <span>-</span>
                                                                    <span v-text="addStaff.departmentName"> 4</span>
                                                                    <span>-</span>
                                                                    <span v-text="addStaff.jobTypeName"></span>
                                                                </a>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">症状简介:</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyAdmissionDetail.admissionSymptoms"  class="col-sm-12" type="text" class="form-control" placeholder="请输入症状简介">
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">费用类型:</label>
                                                    <div class="col-sm-8">
                                                        <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                            <span v-text="modifyAdmissionDetail.feeTypeName"> 费用类型 </span>
                                                            <span class="caret"></span>
                                                        </button>
                                                        <ul role="menu" class="dropdown-menu">
                                                            <li><a href="#" @click="addCheckFeeType(0,'自费')">自费</a></li>
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                                <button type="button" class="btn btn-success" @click="saveModifyAdmission(modifyAdmissionDetail.admissionId)">保存</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="clearfix">
                                    <div class="btn-group">

                                    </div>
                                    <div class="btn-group pull-right">
                                        <ul class="pagination pagination-sm">
                                            <li><a href="#"  @click.prevent="loadAdmissionList(pageinfo.prePage)">上一页</a></li>
                                            <li v-for="n in pageinfo.navigatepageNums" @click.prevent="loadAdmissionList(n)" :class="{'active': n == pageinfo.pageNum}">
                                                <a href="#" v-text="n">1</a>
                                            </li>
                                            <li><a href="#" @click.prevent="loadAdmissionList(pageinfo.nextPage)">下一页</a></li>
                                        </ul>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </div>
        <!--body wrapper end-->

        <!--footer section start-->
        <!--页脚部分开始-->
        <footer>
            2022 &copy; <a href="https://gitee.com/allen-zc/OutpatientManagementSystem" target="_blank">基于SSM的门诊管理系统</a>
            -
            <a href="https://gitee.com/allen-zc" target="_blank">AllenChen曾晨</a>
            -
            <p style="display: inline-block">ALL RIGHTS RESERVED.</p>
        </footer>
        <!--footer section end-->
        <!--页脚部分结束-->


    </div>
    <!-- main content end-->
</section>

<!-- Placed js at the end of the document so the pages load faster -->
<script src="../../js/jquery-1.10.2.min.js"></script>
<script src="../../js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="../../js/jquery-migrate-1.2.1.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/modernizr.min.js"></script>
<script src="../../js/jquery.nicescroll.js"></script>

<!--时间风格及输入框风格-->
<!--pickers plugins-->
<script type="text/javascript" src="../../js/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="../../js/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
<!--pickers initialization-->
<script src="../../js/pickers-init.js"></script>
<!--时间风格及输入框风格-->

<!--data table-->
<script type="text/javascript" src="../../js/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="../../js/data-tables/DT_bootstrap.js"></script>

<!--common scripts for all pages-->
<script src="../../js/scripts.js"></script>


<script src="https://unpkg.zhimg.com/vue"></script>
<!--&lt;!&ndash; 开发环境版本，包含了有帮助的命令行警告 &ndash;&gt;-->
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>-->
<!--&lt;!&ndash; 生产环境版本，优化了尺寸和速度 &ndash;&gt;-->
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>-->
<!--axios-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>

<!--退出登录的方法-->
<script  type="text/javascript" charset="GB2312"  src="../../userjs/logout.js"></script>
<!--工具箱-->
<script src="../../js/utils.js"></script>


<script>
    let admissionApp = new Vue({
        el:"#admissionApp",
        data:{
            addAppointmentDetailInput:'',
            addAppointmentId:'',
            addAppointmentList:[],
            addAdmissionTy:'',
            addAdmissionTypeName:'入院登记类型',
            addDepartmentId:'',
            addDepartmentName:'',
            addDoctorName:'',
            addDoctorId:'',
            addDepartmentList:[],
            addStaffList:[],
            addFeeTypeName:'费用类型',
            addFeeType:'',
            addAdmissionSymptoms:'',
            appointmentList:[],

            selectPageSizeName:'分页数',
            selectPageNum:'1',
            selectPageSize:'10',
            selectAppointmentType:'3',
            selectAppointmentTypeName:'入院类型',
            selectPatientName:'',

            admissionList:[],
            pageinfo:{},
            modifyAdmissionDetail:{},

            modifyDepartmentList:[],
            modifyStaffList:[],
        },
        methods:{
            // 新增 入院登记信息
            addAdmissionButton:function () {
                let form = new FormData();
                form.append("appointmentId", this.addAppointmentId)
                form.append("appointmentType", this.addAdmissionTy)
                form.append("departmentId", this.addDepartmentId)
                form.append("staffId", this.addDoctorId)
                form.append("admissionSymptoms", this.addAdmissionSymptoms)
                form.append("feeType", this.addFeeType)

                axios({
                    url:"/oms/admission/addAdmission",
                    method:"post",
                    data:form
                }).then(function (res) {
                    if (res.data=='ok'){
                        alert("新增成功")
                        // 新增成功刷新新增数据内容
                        // patientApp.resetAddPatient();
                        location.reload();
                    }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 新增 重置
            addAdmissionResetButton:function () {
                $('#addAdmissionTime').val('')
                this.addAppointmentDetailInput= ''
                this.addAppointmentId= ''
                this.addAppointmentList= []
                this.addAdmissionTy= ''
                this.addAdmissionTypeName= '入院类型'
            },
            // 新增 搜索查询预约记录
            addSelectAppointmentList:function () {
                let form = new FormData();
                form.append("patientName", this.addAppointmentDetailInput)
                axios({
                    url:"/oms/appointment/selectAppointmentList",
                    method:"post",
                    data:form
                }).then(function(res){
                    admissionApp.addAppointmentList = res.data.list;
                })
            },
            // 新增 搜索查询科室
            addSelectDepartmentList:function () {
                let form = new FormData();
                form.append("departmentName", this.addDepartmentName)
                axios({
                    url:"/oms/department/selectDepartmentList",
                    method:"post",
                    data:form
                }).then(function(res){
                    admissionApp.addDepartmentList = res.data.list;
                })
            },
            // 新增 搜索查询医生
            addSelectDoctorList:function () {
                let form = new FormData();
                form.append("departmentId", this.addDepartmentId)
                axios({
                    url:"/oms/staff/selectStaffList",
                    method:"post",
                    data:form
                }).then(function(res){
                    admissionApp.addStaffList = res.data.list;
                })
            },
            // 新增 选择 医生
            addCheckThisStaff:function (staffId,staffName,jobTitleName,departmentName) {
                this.addDoctorId = staffId;
                this.addDoctorName = staffId + " " + staffName + " " + jobTitleName + " " + departmentName
            },
            // 新增 选择 选择科室
            addCheckThisDepartment:function (departmentId,specialtyName,departmentName,departmentAddress) {
                this.addDepartmentId = departmentId
                this.addDepartmentName = specialtyName + " " + departmentName + " " + departmentAddress
            },
            // 新增 选择付费类型
            addCheckFeeType:function (feeType,feeTypeName) {
                this.addFeeType = feeType
                this.addFeeTypeName = feeTypeName
            },
            // 新增 选择预约登记类型
            checkThisAppointment:function (appointmentId,patientId,patientName,returnAppointmentStartTime) {
                this.addAppointmentId = appointmentId
                this.addAppointmentDetailInput = patientId + " " + patientName + " 预约号：" + appointmentId + "号" + " 预约日期：" + returnAppointmentStartTime
            },
            // 新增 新增入院类型
            addCheckAdmissionType:function (admissionType,admissionTypeName) {
                this.addAdmissionTypeName = admissionTypeName
                this.addAdmissionTy = admissionType
            },
            //查询 选择分页数
            checkSelectPageNum:function (pageSize) {
                this.selectPageSize = pageSize;
                this.selectPageSizeName = pageSize;
            },
            // 查询 列表
            selectAdmissionButton:function () {
                if (this.selectPageNum==0||this.selectPageNum==''){
                    this.selectPageNum==1
                }
                if (this.selectPageSize==0||this.selectPageSize==''){
                    this.selectPageSize==10
                }
                let selectAdmissionTime = $("#selectAdmissionTime").val()

                let form = new FormData();
                form.append("patientName", this.selectPatientName)
                form.append("selectAdmissionTime", selectAdmissionTime)
                form.append("pageNum", this.selectPageNum)
                form.append("pageSize", this.selectPageSize)

                axios({
                    url:"/oms/admission/selectAdmissionList",
                    method:"post",
                    data:form
                }).then(function(res){
                    admissionApp.admissionList = res.data.list;
                    admissionApp.pageinfo = res.data;
                })
            },
            //查询 重置
            resetSelect:function () {
                this.selectPageSizeName = '分页数';
                this.selectPageNum = '1'
                this.selectPageSize = '10'
                this.selectAppointmentType = '3'
                this.selectAppointmentTypeName = '入院类型'
                this.selectPatientName = ''
                $("#selectAdmissionTime").val('')
                this.selectAdmissionButton();
            },
            // 上一页 下一页
            loadAdmissionList:function (pageNum) {
                this.selectPageNum = pageNum;
                this.selectAdmissionButton();
            },
            // 修改 按钮 查询入院详情
            modifyAdmissionButton:function (admissionId) {
                let form = new FormData();
                form.append("admissionId", admissionId)
                axios({
                    url:"/oms/admission/selectAdmissionDetail",
                    method:"post",
                    data:form
                }).then(function(res){
                    admissionApp.modifyAdmissionDetail = res.data;
                })
            },
            // 修改 选择入院类型
            modifyCheckAdmissionType:function (admissionType,admissionTypeName) {
                this.modifyAdmissionDetail.appointmentTypeName = admissionTypeName
                this.modifyAdmissionDetail.appointmentType = admissionType
            },
            // 修改 查询科室
            admissionModifySelectDepartmentList:function () {
                let form = new FormData();
                form.append("departmentName", this.modifyAdmissionDetail.departmentName)
                axios({
                    url:"/oms/department/selectDepartmentList",
                    method:"post",
                    data:form
                }).then(function(res){
                    admissionApp.modifyDepartmentList = res.data.list;
                })
            },
            // 修改 选择科室
            admissionModifyCheckThisDepartment:function (departmentId,specialtyName,departmentName,departmentAddress) {
                this.modifyAdmissionDetail.departmentId = departmentId
                this.modifyAdmissionDetail.departmentName = specialtyName + " " + departmentName + " " + departmentAddress
            },
            // 修改 查询医生
            admissionModifySelectDoctorList:function () {
                let form = new FormData();
                form.append("departmentId", this.modifyAdmissionDetail.departmentId);
                axios({
                    url:"/oms/staff/selectStaffList",
                    method:"post",
                    data:form
                }).then(function(res){
                    admissionApp.modifyStaffList = res.data.list;
                })
            },
            // 修改 选择医生
            modifyCheckThisStaff:function (staffId,staffName,jobTitleName,departmentName) {
                this.modifyAdmissionDetail.staffId = staffId;
                this.modifyAdmissionDetail.staffName = staffId + " " + staffName + " " + jobTitleName + " " + departmentName
            },
            // 修改 保存
            saveModifyAdmission:function (admissionId) {
                let form = new FormData();
                form.append("admissionId", admissionId)
                form.append("appointmentId", this.modifyAdmissionDetail.appointmentId)
                form.append("appointmentType", this.modifyAdmissionDetail.appointmentType)
                form.append("departmentId", this.modifyAdmissionDetail.departmentId)
                form.append("staffId", this.modifyAdmissionDetail.staffId)
                form.append("admissionSymptoms", this.modifyAdmissionDetail.admissionSymptoms)
                form.append("feeType", this.modifyAdmissionDetail.feeType)

                axios({
                    url:"/oms/admission/updateAdmission",
                    method:"post",
                    data:form
                }).then(function (res) {
                    if (res.data=='ok'){
                        alert("新增成功")
                        location.reload();
                    }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 删除入院记录
            deleteAdmission:function (admissionId) {
                axios({
                    url:"/oms/admission/deleteAdmission/" + admissionId,
                    method:"get",
                }).then(function (res) {
                    if (res.data=='ok'){
                        alert("删除成功")
                        location.reload();
                    }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            }

        },
        //创建执行的方法
        created:function () {
            // 加载完成直接查询入院登记信息
           this.selectAdmissionButton();
        }

    })
</script>

</body>
</html>
